package com.baigt.jvm.gc;

/**
 -verbose:gc
 -Xms20M
 -Xmx20M
 -Xmn10M
 -XX:+PrintGCDetails
 -XX:SurvivorRatio=8
 -XX:+UseConcMarkSweepGC
 */
public class GCCMSDemo {
    /**
     11111111111111111111
     [GC (Allocation Failure) [ParNew: 6409K->784K(9216K), 0.0042560 secs] 6409K->4882K(19456K), 0.0043057 secs] [Times: user=0.02 sys=0.00, real=0.01 secs]
     22222222222222222222
     [GC (Allocation Failure) [ParNew: 5118K->476K(9216K), 0.0038330 secs] 9216K->9434K(19456K), 0.0038629 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     [GC (CMS Initial Mark) [1 CMS-initial-mark: 8957K(10240K)] 13530K(19456K), 0.0001722 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     [CMS-concurrent-mark-start]
     33333333333333333333
     44444444444444444444
     [CMS-concurrent-mark: 0.001/0.001 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     [CMS-concurrent-preclean-start]
     [CMS-concurrent-preclean: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     [CMS-concurrent-abortable-preclean-start]
     [CMS-concurrent-abortable-preclean: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     [GC (CMS Final Remark) [YG occupancy: 6776 K (9216 K)][Rescan (parallel) , 0.0000986 secs][weak refs processing, 0.0000106 secs][class unloading, 0.0002762 secs][scrub symbol table, 0.0005185 secs][scrub string table, 0.0001547 secs][1 CMS-remark: 8957K(10240K)] 15734K(19456K), 0.0011444 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     [CMS-concurrent-sweep-start]
     [CMS-concurrent-sweep: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     [CMS-concurrent-reset-start]
     [CMS-concurrent-reset: 0.000/0.000 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]
     Heap
     par new generation   total 9216K, used 7662K [0x00000000fec00000, 0x00000000ff600000, 0x00000000ff600000)
     eden space 8192K,  87% used [0x00000000fec00000, 0x00000000ff304548, 0x00000000ff400000)
     from space 1024K,  46% used [0x00000000ff400000, 0x00000000ff477388, 0x00000000ff500000)
     to   space 1024K,   0% used [0x00000000ff500000, 0x00000000ff500000, 0x00000000ff600000)
     concurrent mark-sweep generation total 10240K, used 8956K [0x00000000ff600000, 0x0000000100000000, 0x0000000100000000)
     Metaspace       used 3673K, capacity 4536K, committed 4864K, reserved 1056768K
     class space    used 407K, capacity 428K, committed 512K, reserved 1048576K
     * @param args
     */
    public static void main(String[] args) throws InterruptedException {
        int size = 1024 * 1024;//1m
        byte[] one = new byte[4 * size];
        System.out.println("11111111111111111111");
        byte[] two = new byte[4 * size];
        System.out.println("22222222222222222222");
        byte[] three = new byte[4 * size];
        System.out.println("33333333333333333333");
        byte[] four = new byte[2 * size];
        System.out.println("44444444444444444444");
        Thread.sleep(100);
    }
}
